package cn.mujiankeji.mbrowser.界面.标签页

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier


@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun 统一标签页布局(
    title : @Composable () -> String,
    action : @Composable RowScope.() -> Unit = {},
    content : @Composable ColumnScope.() -> Unit,
){

    Scaffold(topBar = {
        TopAppBar(
            title = {
                Text( title.invoke(), maxLines = 1)
            },
            actions = {
                action()
            },
            colors = TopAppBarDefaults.topAppBarColors().copy(containerColor = MaterialTheme.colorScheme.background))
    }) {paddingValue->
        Column(modifier = Modifier.padding(top = paddingValue.calculateTopPadding())) {
            content()
        }
    }

}